<template>
  <a-form-model ref="form" :rules="rules" style="padding: 0px">

      <a-form-model-item :labelCol="labelCol1" :wrapperCol="wrapperCol1" label="tracker_servers">
          <a-input style="width: 80%" placeholder="*.*.*.*:22122,*.*.*.*:22122" v-model="tracker_servers"/>
      </a-form-model-item>

      <a-form-model-item :labelCol="labelCol1" :wrapperCol="wrapperCol1" :label="i18n('form.tmpPath','临时目录')">
          <a-input style="width: 80%" :placeholder="i18n('form.pdfTmpDir','PDF临时路径')" v-model="pdfTmpPath"/>
      </a-form-model-item>

    <a-form-model-item :labelCol="labelCol1" :wrapperCol="wrapperCol1" :label="i18n('form.connectTime','连接时间')">
      <a-input-number :min="1" :max="300000" :placeholder="i18n('form.connectTime','连接时间')" v-model="connect_timeout"
                      style="width: 80%!important;"/>
    </a-form-model-item>

    <a-form-model-item :labelCol="labelCol1" :wrapperCol="wrapperCol1" :label="i18n('form.timeout','超时时间')">
      <a-input-number :min="1" :max="300000" :placeholder="i18n('form.timeout','超时时间')" v-model="network_timeout"
                      style="width: 80%!important;"/>
    </a-form-model-item>

    <a-form-model-item :labelCol="labelCol1" :wrapperCol="wrapperCol1" :label="i18n('form.coding','编码')">
      <a-input style="width: 80%" :placeholder="i18n('form.codingDesc','请输入编码：UTF-8')" v-model="charset"/>
    </a-form-model-item>


    <a-form-model-item :labelCol="labelCol1" :wrapperCol="wrapperCol1" label="token">
      <a-input style="width: 80%" placeholder="token" v-model="http_anti_steal_token"/>
    </a-form-model-item>

    <a-form-model-item :labelCol="labelCol1" :wrapperCol="wrapperCol1" :label="i18n('form.secretKey','密钥')">
      <a-input style="width: 80%" :placeholder="i18n('form.secretKey','密钥')" v-model="http_secret_key"/>
    </a-form-model-item>




  </a-form-model>
</template>

<script>
  import {BaseFormModel, RxDialog, Dialog} from "@lowcode/jpaas-common-lib";
  import rxAjax from '@/assets/js/ajax.js';

  export default {
    name: "SysFileStorefastdfs",
    mixins: [BaseFormModel],
    components: {
      RxDialog, rxAjax,
    },
    props: {
      dataObj: {
        type: Object,
        default: {}
      }
    },

    data() {
      return {
        pdfTmpPath:this.dataObj.pdfTmpPath || "",
        connect_timeout: this.dataObj.connect_timeout || 1,
        network_timeout: this.dataObj.network_timeout || 30,
        charset: this.dataObj.charset || "",
        http_tracker_http_port: this.dataObj.http_tracker_http_port || "",
        http_anti_steal_token: this.dataObj.http_anti_steal_token || "",
        http_secret_key: this.dataObj.http_secret_key || "",
        tracker_servers: this.dataObj.tracker_servers || "",
        rules: {
          connect_timeout: [{required: true, message: this.i18n('form.connectTime','连接时间','input'), trigger: 'change'}],
          network_timeout: [{required: true, message: this.i18n('form.timeout','超时时间','input'), trigger: 'change'}],
          charset: [{required: true, message: this.i18n('form.charset','编码','input'), trigger: 'change'}],
          http_tracker_http_port: [{required: true, message: this.i18n('form.enterPort','请输入编码'), trigger: 'change'}],
          http_anti_steal_token: [{required: true, message: this.i18n('form.token','token','input'), trigger: 'change'}],
          http_secret_key: [{required: true, message: this.i18n('form.secretKey','密钥','input'), trigger: 'change'}],
          tracker_servers: [{required: true, message: this.i18n('form.enterService','请输入服务'), trigger: 'change'}],
        }
      }
    },
    methods: {
        i18n(name,text,key){
            return this.$ti18(name,text,"SysFileStore",key);
        }
    },
    watch: {
      connect_timeout: function (val) {
        this.dataObj.connect_timeout = val;
        this.$emit("change", this.dataObj);
      },
      network_timeout: function (val) {
        this.dataObj.network_timeout = val;
        this.$emit("change", this.dataObj);
      },
      charset: function (val) {
        this.dataObj.charset = val;
        this.$emit("change", this.dataObj);
      },
      http_tracker_http_port: function (val) {
        this.dataObj.http_tracker_http_port = val;
        this.$emit("change", this.dataObj);
      },
      http_anti_steal_token: function (val) {
        this.dataObj.http_anti_steal_token = val;
        this.$emit("change", this.dataObj);
      },
      http_secret_key: function (val) {
        this.dataObj.http_secret_key = val;
        this.$emit("change", this.dataObj);
      },
      tracker_servers: function (val) {
        this.dataObj.tracker_servers = val;
        this.$emit("change", this.dataObj);
      },
      pdfTmpPath: function (val) {
        this.dataObj.pdfTmpPath = val;
        this.$emit("change", this.dataObj);
      }
    },

  }
</script>

<style scoped>

</style>